package test8;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Demo4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int M = sc.nextInt();
        int N = sc.nextInt();
        int[] nums = new int[M + N];
        for (int i = 0; i < M; i++) {
            nums[i] = 2;
        }

        for (int i = M; i < M + N; i++) {
            nums[i] = -1;
        }
        List<List<Integer>> lists = permuteUnique(nums);
        System.out.println(lists.size());

    }

    static List<List<Integer>> res = new LinkedList<>();
    static LinkedList<Integer> track = new LinkedList<>();
    static boolean[] used;

    public static List<List<Integer>> permuteUnique(int[] nums) {
        // 先排序，让相同的元素靠在一起
        Arrays.sort(nums);
        used = new boolean[nums.length];
        backtrack(nums);
        return res;
    }

    static void backtrack(int[] nums) {
        if (track.size() == nums.length) {
            int C = 3;
            for (int i = 0; i < track.size(); i++) {
                if (track.get(i) == 2) C = 2 * C;
                if (track.get(i) == -1) C --;
                if (C <= 0 && i < track.size() - 1) {
                    return;
                }
            }
            if (C == 0) {
                res.add(new LinkedList(track));
            }
            return;
        }

        for (int i = 0; i < nums.length; i++) {
            if (used[i]) {
                continue;
            }
            // 新添加的剪枝逻辑，固定相同的元素在排列中的相对位置
            if (i > 0 && nums[i] == nums[i - 1] && !used[i - 1]) {
                continue;
            }
            track.add(nums[i]);
            used[i] = true;
            backtrack(nums);
            track.removeLast();
            used[i] = false;
        }
    }
}
